home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 February / EnigmA AMIGA RUN 34 (1999)(G.R. Edizioni)(IT)[!][issue 1999-02].iso / earcd / devel / libx11 / include / x11 / xaw / list.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  8KB  |  227 lines

  1. /* $XConsortium: List.h,v 1.20 91/07/26 20:07:51 converse Exp $
  2.  *
  3.  * Copyright 1989 Massachusetts Institute of Technology
  4.  *
  5.  * Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of M.I.T. not be used in advertising or
  10.  * publicity pertaining to distribution of the software without specific,
  11.  * written prior permission.  M.I.T. makes no representations about the
  12.  * suitability of this software for any purpose.  It is provided "as is"
  13.  * without express or implied warranty.
  14.  *
  15.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  16.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  17.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  19.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  20.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*  This is the List widget, it is useful to display a list, without the
  24.  *  overhead of having a widget for each item in the list.  It allows 
  25.  *  the user to select an item in a list and notifies the application through
  26.  *  a callback function.
  27.  *
  28.  *    Created:     8/13/88
  29.  *    By:        Chris D. Peterson
  30.  *                      MIT X Consortium
  31.  */
  32.  
  33. #ifndef _XawList_h
  34. #define _XawList_h
  35.  
  36. /***********************************************************************
  37.  *
  38.  * List Widget
  39.  *
  40.  ***********************************************************************/
  41.  
  42. #include <X11/Xaw/Simple.h>
  43. #include <X11/Xfuncproto.h>
  44.  
  45. /* Resources:
  46.  
  47.  Name             Class        RepType        Default Value
  48.  ----             -----        -------        -------------
  49.  background         Background        Pixel        XtDefaultBackground
  50.  border             BorderColor    Pixel        XtDefaultForeground
  51.  borderWidth         BorderWidth    Dimension    1
  52.  callback            Callback           XtCallbackList  NULL       **6
  53.  columnSpacing       Spacing            Dimension       6
  54.  cursor             Cursor        Cursor        left_ptr
  55.  cursorName         Cursor        String        NULL
  56.  defaultColumns      Columns            int             2          **5
  57.  destroyCallback     Callback        Pointer        NULL 
  58.  font             Font        XFontStruct*    XtDefaultFont
  59.  forceColumns        Columns            Boolean         False      **5
  60.  foreground         Foreground        Pixel        XtDefaultForeground
  61.  height             Height        Dimension    0          **1
  62.  insensitiveBorder   Insensitive    Pixmap        Gray
  63.  internalHeight         Height        Dimension    2
  64.  internalWidth         Width        Dimension    4
  65.  list                List               String *        NULL       **2
  66.  longest             Longest            int             0          **3  **4
  67.  mappedWhenManaged   MappedWhenManaged    Boolean        True
  68.  numberStrings       NumberStrings      int             0          **4
  69.  pasteBuffer         Boolean            Boolean         False
  70.  pointerColor         Foreground        Pixel        XtDefaultForeground
  71.  pointerColorBackground Background    Pixel        XtDefaultBackground
  72.  rowSpacing          Spacing            Dimension       4
  73.  sensitive         Sensitive        Boolean        True
  74.  verticalList        Boolean            Boolean         False
  75.  width             Width        Dimension    0          **1
  76.  x             Position        Position    0
  77.  y             Position        Position    0
  78.  
  79.  **1 - If the Width or Height of the list widget is zero (0) then the value
  80.        is set to the minimum size necessay to fit the entire list.
  81.  
  82.        If both Width and Height are zero then they are adjusted to fit the
  83.        entire list that is created width the number of default columns 
  84.        specified in the defaultColumns resource.
  85.  
  86.  **2 - This is an array of strings the specify elements of the list.
  87.        This resource must be specified. 
  88.        (What good is a list widget without a list??  :-)
  89.  
  90.  **3 - Longest is the length of the widest string in pixels.
  91.  
  92.  **4 - If either of these values are zero (0) then the list widget calculates
  93.        the correct value. 
  94.  
  95.        (This allows you to make startup faster if you already have 
  96.         this information calculated)
  97.  
  98.        NOTE: If the numberStrings value is zero the list must 
  99.              be NULL terminated.
  100.  
  101.  **5 - By setting the List.Columns resource you can force the application to
  102.        have a given number of columns.         
  103.         
  104.  **6 - This returns the name and index of the item selected in an 
  105.        XawListReturnStruct that is pointed to by the client_data
  106.        in the CallbackProc.
  107.  
  108. */
  109.  
  110.  
  111. /*
  112.  * Value returned when there are no highlighted objects. 
  113.  */
  114.  
  115. #define XAW_LIST_NONE -1    
  116.  
  117. #define XtCList "List"
  118. #define XtCSpacing "Spacing"
  119. #define XtCColumns "Columns"
  120. #define XtCLongest "Longest"
  121. #define XtCNumberStrings "NumberStrings"
  122.  
  123. #define XtNcursor "cursor"
  124. #define XtNcolumnSpacing "columnSpacing"
  125. #define XtNdefaultColumns "defaultColumns"
  126. #define XtNforceColumns "forceColumns"
  127. #define XtNlist "list"
  128. #define XtNlongest "longest"
  129. #define XtNnumberStrings "numberStrings"
  130. #define XtNpasteBuffer "pasteBuffer"
  131. #define XtNrowSpacing "rowSpacing"
  132. #define XtNverticalList "verticalList"
  133.  
  134. /* Class record constants */
  135.  
  136. extern WidgetClass listWidgetClass;
  137.  
  138. typedef struct _ListClassRec *ListWidgetClass;
  139. typedef struct _ListRec      *ListWidget;
  140.  
  141. /* The list return structure. */
  142.  
  143. typedef struct _XawListReturnStruct {
  144.   String string;
  145.   int list_index;
  146. } XawListReturnStruct;
  147.  
  148. /******************************************************************
  149.  *
  150.  * Exported Functions
  151.  *
  152.  *****************************************************************/
  153.  
  154. _XFUNCPROTOBEGIN
  155.  
  156. /*    Function Name: XawListChange.
  157.  *    Description: Changes the list being used and shown.
  158.  *    Arguments: w - the list widget.
  159.  *                 list - the new list.
  160.  *                 nitems - the number of items in the list.
  161.  *                 longest - the length (in Pixels) of the longest element
  162.  *                           in the list.
  163.  *                 resize - if TRUE the the list widget will
  164.  *                          try to resize itself.
  165.  *    Returns: none.
  166.  *      NOTE:      If nitems of longest are <= 0 then they will be caluculated.
  167.  *                 If nitems is <= 0 then the list needs to be NULL terminated.
  168.  */
  169.  
  170. extern void XawListChange(
  171. #if NeedFunctionPrototypes
  172.     Widget        /* w */,
  173.     String*        /* list */,
  174.     int            /* nitems */,
  175.     int            /* longest */,
  176. #if NeedWidePrototypes
  177.     /* Boolean */ int    /* resize */
  178. #else
  179.     Boolean        /* resize */
  180. #endif
  181. #endif
  182. );
  183.  
  184. /*    Function Name: XawListUnhighlight
  185.  *    Description: unlights the current highlighted element.
  186.  *    Arguments: w - the widget.
  187.  *    Returns: none.
  188.  */
  189.  
  190. extern void XawListUnhighlight(
  191. #if NeedFunctionPrototypes
  192.     Widget        /* w */
  193. #endif
  194. );
  195.  
  196. /*    Function Name: XawListHighlight
  197.  *    Description: Highlights the given item.
  198.  *    Arguments: w - the list widget.
  199.  *                 item - the item to highlight.
  200.  *    Returns: none.
  201.  */
  202.  
  203. extern void XawListHighlight(
  204. #if NeedFunctionPrototypes
  205.     Widget        /* w */,
  206.     int            /* item */
  207. #endif
  208. );
  209.  
  210.  
  211. /*    Function Name: XawListShowCurrent
  212.  *    Description: returns the currently highlighted object.
  213.  *    Arguments: w - the list widget.
  214.  *    Returns: the info about the currently highlighted object.
  215.  */
  216.  
  217. extern XawListReturnStruct * XawListShowCurrent(
  218. #if NeedFunctionPrototypes
  219.     Widget        /* w */
  220. #endif
  221. );
  222.  
  223. _XFUNCPROTOEND
  224.  
  225. #endif /* _XawList_h */
  226. /* DON'T ADD STUFF AFTER THIS #endif */
  227.